package okw.database;

import java.util.List;

import okw.database.model.MessagePackage;
import okw.database.model.MessageReceived;
import okw.database.model.MessageToSend;
import okw.database.model.Node;
import core.communication.message.Direction;
import core.communication.message.Message;

public interface DatabaseService {

	public Node getMainNode();

	public Node storeNode(Node node);

	public void deleteNode(Node node);

	public List<Node> getNodesForDirection(Direction direction);

	public List<MessageToSend> getMessagesToSend();

	public List<MessageReceived> getMessagesReceived();

	public void saveReceivedMessage(Message message);

	public void setMessageAsHandled(Long messageToSendDatabaseId);

	public Boolean isNodeLocatorUriTaken(String ip, String port);

	public void removeMessageToSend(Long messageToSendDatabaseId);

	public void storeMessageToSend(Message message);

	public void deleteNode(String locatorUri);

	public Node updateNode(String targetNodeUri, Node newNode);

	public List<MessagePackage> getVotesPackages();

	public List<MessagePackage> getVotersPackages();

	public void deletePackages(List<MessagePackage> packages);

	public void storePackage(Message message);

}
